package com.java.imauoj.sercive;

import com.java.imauoj.mapper.SubmitMapper;
import com.java.imauoj.moudel.FanHuiZhi;
import com.java.imauoj.moudel.Filter;
import com.java.imauoj.moudel.Solution;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SubmitService {

    @Autowired
    private SubmitMapper mapper;


    public void   addSolution(Solution solution){
        mapper.addSolution(solution);
    }

    public void addSourceCode(int solution_id,String source){
        mapper.addSourceCode(solution_id,source);
    }

    public Solution getResult(int solution_id){
        Solution solution = mapper.getResult(solution_id);
        return solution;
    }

    public List<Solution> getSolutionList(FanHuiZhi fhz){
         String sql = fhz.getSql();
         String[] sz = fhz.getFhz();
        List<Solution> list = mapper.getSolutionList(sql,sz);
        return list;
    }
    public List<Solution> getSolution(int solution){
        List<Solution> list = mapper.getSolution(solution);
        return list;
    }
}
